﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="ListContact.aspx.cs" Inherits="SD.Web.Iteration1.Contacts.ListContact" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentTitle" runat="server">
    <h2>
        List Contact</h2>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Content" runat="server">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" EnablePaging="true"
                 SelectCountMethod="CountContact" MaximumRowsParameterName="maximumRows" 
                 StartRowIndexParameterName="startRowIndex" SortParameterName="sortType"
                SelectMethod="GetListContact" TypeName="SD.Business.ContactBUS">
                <SelectParameters>
                    <asp:ControlParameter ControlID="chkInactive" DefaultValue="false" Name="filter"
                        PropertyName="Checked" Type="Boolean" />
                    <asp:ControlParameter ControlID="txtFirstName" Name="firstName" PropertyName="Text"
                        Type="String" />
                    <asp:ControlParameter ControlID="txtSurName" Name="surName" PropertyName="Text" Type="String" />
                </SelectParameters>
            </asp:ObjectDataSource>
            <asp:Panel ID="PanelListContacts" runat="server">
                <div class="grid740 simplebox">
                    <asp:Panel ID="SearchPanel" runat="server" DefaultButton="btnSearchContact">
                        <div class="st-form-line-noleft">
                            <div class="half">
                                <asp:Label ID="FirstNameLabel" CssClass="st-labeltext" runat="server" Text="First Name"></asp:Label>
                                <asp:TextBox ID="txtFirstName" CssClass="st-forminput" runat="server" Width="200px"></asp:TextBox>
                            </div>
                            <div class="half">
                                <asp:Label ID="LabelName" runat="server" CssClass="st-labeltext" Text="Surname"></asp:Label>
                                <asp:TextBox ID="txtSurName" runat="server" CssClass="st-forminput" Width="200px"></asp:TextBox>
                            </div>
                            <div class="clear">
                            </div>
                        </div>
                        <div class="button-box">
                            <asp:Button ID="btnSearchContact" runat="server" Text="Search" 
                                CssClass="st-button" />
                            <%--<asp:Button ID="ButtonNone" runat="server" Text="None" CssClass="st-button" Visible="False" />--%>
                            <input id="Reset1" type="reset" value="Clear" class="st-button" />
                            <asp:Button ID="btnCreateContact" runat="server" Text="Create" CssClass="st-button"
                                OnClick="btnCreateContact_Click" />
                        </div>
                    </asp:Panel>
                    <!-- end search panel -->
                    <div class="titleh">
                        <h3>
                            <asp:CheckBox ID="chkInactive" runat="server" Text="Include In-active contact ?"
                                AutoPostBack="True" /></h3>
                    </div>
                    <asp:GridView ID="gridContacts" CssClass="tablesorter" runat="server" AutoGenerateColumns="False"
                        AllowPaging="True" AllowSorting="True" DataSourceID="ObjectDataSource1">
                        <Columns>
                            <asp:TemplateField>
                                <ItemTemplate>
                                    <input id="Radio1" type="radio" name="MyRadioButton" value='<%#Eval("ContactId")%>' />
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField DataField="FirstName" HeaderText="FirstName" SortExpression="FirstName"
                            HeaderStyle-CssClass="header" >
                            <HeaderStyle CssClass="header" />
                            </asp:BoundField>
                            <asp:BoundField DataField="Surname" HeaderText="Surname" SortExpression="Surname"
                            HeaderStyle-CssClass="header" >
                            
                            
                            <HeaderStyle CssClass="header" />
                            </asp:BoundField>
                            
                            
                            <asp:BoundField DataField="MobilePhone" HeaderText="MobilePhone" 
                                SortExpression="MobilePhone" HeaderStyle-CssClass="header" >
                            
                            <HeaderStyle CssClass="header" />
                            </asp:BoundField>
                            
                            <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" 
                                HeaderStyle-CssClass="header">
                            <HeaderStyle CssClass="header" />
                            </asp:BoundField>
                            <asp:TemplateField HeaderText="Contact Type" SortExpression="ContactTypeName">
                                <ItemTemplate>
                                    <asp:Label ID="Label4" runat="server" Text='<%#Eval("contacttype.ContactTypeName")%>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="header" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Is Active ?" SortExpression="IsActive">
                                <ItemTemplate>
                                    <asp:Label ID="Label5" runat="server" Text='<%#(bool) Eval("IsActive") ? "Yes" : "No"%>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="header" />
                            </asp:TemplateField>
                        </Columns>
                        <PagerSettings Mode="NextPreviousFirstLast" />
                        <PagerStyle CssClass="pagination_table"></PagerStyle>
                    </asp:GridView>
                </div>
            </asp:Panel>
            <asp:Button ID="btnEdit" runat="server" Text="Edit" CssClass="st-button" onclick="btnEdit_Click" />
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
